package io.finer.erp.jeecg.bas.controller;

import java.util.Collection;
import java.util.Map;

import org.jeecg.modules.online.cgform.enhance.CgformEnhanceJavaInter;
import org.jeecg.modules.online.config.exception.BusinessException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSONObject;

import io.finer.erp.jeecg.bas.entity.ZzShoporder;
import io.finer.erp.jeecg.bas.service.IZzShoporderService;
import me.kagura.JSONQuery;
import me.kagura.JsonResult;
import me.kagura.exception.FieldNotExistException;
import me.kagura.exception.TypeNotMismatchException;

@Component("generateQZOrder")
public class GenerateQZOrder implements CgformEnhanceJavaInter {
	
	@Autowired
	private IZzShoporderService zzShoporderService;

	@Override
	public int execute(String arg0, Map<String, Object> arg1) throws BusinessException {
		return 0;
	}

	@Override
	public int execute(String arg0, JSONObject arg1) throws BusinessException {
		System.out.println(arg1+"=============");
		//解析前端参数
		try {
			Collection<ZzShoporder> collection=zzShoporderService.list();
			System.out.println(collection.size());
			JsonResult jsonResult = JSONQuery.select(arg1.toString(), "process_id");
			if(!jsonResult.equals("1300701144731623426")&&!jsonResult.equals("1300701196116041729")) {
				throw new BusinessException("分切不能操作！");
			}
		} catch (TypeNotMismatchException e) {
			e.printStackTrace();
		} catch (FieldNotExistException e) {
			e.printStackTrace();
		}
		return 0;
	}

}
